package nus.mtech.subscription;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;

import nus.mtech.rate.CableRate;
import nus.mtech.rate.RateManager;

/**
 * 
 */

/**
 * @author Chew Xunmao
 * 
 */
public class CableTV extends Subscription {
	private static final long serialVersionUID = -6754173567913661970L;
	
	// String stores cabletv channel name
	private HashMap<String, CableTVChannel> mapOfCableTVChannels;
	private CableRate cableRate;

	public CableTV(Date startDate, Date endDate, boolean activeStatus) {
		super(startDate, endDate, activeStatus);
		cableRate = RateManager.getRateManagerInstance().getCableRate();
		mapOfCableTVChannels = new HashMap<String, CableTVChannel>();
	}

	// need to know if channels will be duplicated
	public void addChannel(String cableTVName, CableTVChannel newCableTVChannel) {
		if (!mapOfCableTVChannels.containsKey(cableTVName))
			mapOfCableTVChannels.put(cableTVName, newCableTVChannel);
	}

	public ArrayList<CableTVChannel> getChannels() {
		ArrayList<CableTVChannel> lReturnCableTVList = new ArrayList<CableTVChannel>();
		for (CableTVChannel lTmpCableTVChannel : mapOfCableTVChannels.values()) {
			lReturnCableTVList.add(lTmpCableTVChannel);
		}

		return lReturnCableTVList;
	}

	public CableRate getCableTVRate() {
		return RateManager.getRateManagerInstance().getCableRate();
	}

	public HashMap<String, CableTVChannel> getMapOfCableTVChannels() {
		return mapOfCableTVChannels;
	}
}
